﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

public partial class Account_Logout : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            logout();
        }
    }

    private void logout()
    {

        try
        {
            //清空Cookie
            Response.Cookies[ConfigurationManager.AppSettings["COOKIE_KEY_USER"] as string].Expires = DateTime.Now.AddDays(-1);
            Response.Cookies.Add(Response.Cookies[ConfigurationManager.AppSettings["COOKIE_KEY_USER"] as string]);
            Response.Redirect(ResolveUrl("..//Account/Login.aspx"));
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
}